package com.yunxi.core.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 枫下 on 2018/3/21.
 */
public class DMSEnumsEntity {

    public static enum SourceType {
        a(1, "录入数据"), b(2, "对接数据");
        private Integer value;
        private String desc;
        private SourceType(Integer value, String desc) {
            this.value = value;
            this.desc = desc;
        }
        public Integer getValue() {
            return this.value;
        }
        public void setValue(Integer value) {
            this.value = value;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public static String getDesc(Integer value) {
            for (SourceType sourceType : SourceType.values()) {
                if (sourceType.getValue().intValue() == value.intValue()) {
                    return sourceType.getDesc();
                }
            }
            return null;
        }
        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (SourceType sourceType : SourceType.values()) {
                Map map = new HashMap();
                map.put("key", sourceType.getValue());
                map.put("value", sourceType.getDesc());
                list.add(map);
            }
            return list;
        }
    }

    public static enum PriceBigType {
        PRICE(0,"价格"), DISCOUNT(1,"折扣"),REBATE(2,"返利");

        private String typeName;
        private int code;

        private PriceBigType(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (OrderStatus type : OrderStatus.values()) {
                if (type.getCode() == code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (PriceBigType bigType : PriceBigType.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum IsValidType {
        a(1, "有效"), b(0, "无效");
        private Integer value;
        private String desc;
        private IsValidType(Integer value, String desc) {
            this.value = value;
            this.desc = desc;
        }
        public Integer getValue() {
            return this.value;
        }
        public void setValue(Integer value) {
            this.value = value;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public static String getDesc(Integer value) {
            for (IsValidType statusType : IsValidType.values()) {
                if (statusType.getValue().intValue() == value.intValue()) {
                    return statusType.getDesc();
                }
            }
            return null;
        }
        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (IsValidType statusType : IsValidType.values()) {
                Map map = new HashMap();
                map.put("key", statusType.getValue());
                map.put("value", statusType.getDesc());
                list.add(map);
            }
            return list;
        }
    }

    public static enum IsUseType {
        a(1,"可用"),b(0,"不可用");
        private int key;
        private String value;
        private IsUseType(int key, String value) {
            this.key = key;
            this.value = value;
        }
        public static String getTypeName(int key) {
            for(IsUseType carStatus : IsUseType.values()){
                if(carStatus.getKey() == key){
                    return carStatus.value;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for(IsUseType carStatus : IsUseType.values()){
                Map map = new HashMap();
                map.put("key",carStatus.getKey());
                map.put("value",carStatus.getValue());
                list.add(map);
            }
            return list;
        }

        public int getKey() {
            return key;
        }

        public void setKey(int key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

    public static enum OpenCloseType {
        OPEN(1,"是"),CLOSE(0,"否");
        private String typeName;
        private int status;
        private OpenCloseType( int status,String typeName){
            this.typeName = typeName;
            this.status = status;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public static String getTypeName(int status) {
            for(OpenCloseType tcbYesOrNo : OpenCloseType.values()){
                if(tcbYesOrNo.getStatus() == status){
                    return tcbYesOrNo.typeName ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for(OpenCloseType carStatusType : OpenCloseType.values()){
                Map map = new HashMap();
                map.put("key",carStatusType.getStatus());
                map.put("value",carStatusType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum OrderStatus {
        WAIT(0,"草稿"), CANCEL(-1,"作废"),AUDIT(1,"待审核"),COMMIT(2,"已提交");

        private String typeName;
        private int code;

        private OrderStatus(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (OrderStatus type : OrderStatus.values()) {
                if (type.getCode() == code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (OrderStatus carStatusType : OrderStatus.values()) {
                Map map = new HashMap();
                map.put("key", carStatusType.getCode());
                map.put("value", carStatusType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum YesNo {
        YES("是",1),NO("否",0);
        private String typeName;
        private int status;
        private YesNo(String typeName, int status){
            this.typeName = typeName;
            this.status = status;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public static String getTypeName(int status) {
            for(YesNo yesNo : YesNo.values()){
                if(yesNo.getStatus() == status){
                    return yesNo.typeName ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (YesNo carStatusType : YesNo.values()) {
                Map map = new HashMap();
                map.put("key", carStatusType.getStatus());
                map.put("value", carStatusType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum ApplyType {
        PASS(1,"通过"),UNPASS(0,"不通过"),CANCEL(-1,"作废");

        private Integer value;
        private String desc;

        private ApplyType(Integer value, String desc){
            this.value = value;
            this.desc = desc;
        }

        public Integer getValue() {
            return this.value;
        }

        public void setValue(Integer value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static String getDesc(Integer value) {
            for(ApplyType userType : ApplyType.values()){
                if(userType.getValue().intValue() == value.intValue()){
                    return userType.getDesc() ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (ApplyType type : ApplyType.values()) {
                Map map = new HashMap();
                map.put("key", type.getValue());
                map.put("value", type.getDesc());
                list.add(map);
            }
            return list;
        }
    }

    public static enum IsPublish {
        UNPUBLISH(0,"未发布"),PUBLISH(1,"已发布");

        private Integer value;
        private String desc;

        private IsPublish(Integer value, String desc){
            this.value = value;
            this.desc = desc;
        }

        public Integer getValue() {
            return this.value;
        }

        public void setValue(Integer value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static String getDesc(Integer value) {
            for(IsPublish userType : IsPublish.values()){
                if(userType.getValue().intValue() == value.intValue()){
                    return userType.getDesc() ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (IsPublish type : IsPublish.values()) {
                Map map = new HashMap();
                map.put("key", type.getValue());
                map.put("value", type.getDesc());
                list.add(map);
            }
            return list;
        }
    }

    public static enum IsConfirm {
        UNCHECK(0,"未确认"),CHECK(1,"已确认");

        private Integer value;
        private String desc;

        private IsConfirm(Integer value, String desc){
            this.value = value;
            this.desc = desc;
        }

        public Integer getValue() {
            return this.value;
        }

        public void setValue(Integer value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static String getDesc(Integer value) {
            for(IsConfirm userType : IsConfirm.values()){
                if(userType.getValue().intValue() == value.intValue()){
                    return userType.getDesc() ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (IsConfirm type : IsConfirm.values()) {
                Map map = new HashMap();
                map.put("key", type.getValue());
                map.put("value", type.getDesc());
                list.add(map);
            }
            return list;
        }
    }

    public static enum OperateType {
        INSERT("I","新增"),UPDATE("U","更新"),DELETE("D","删除"),NONE("N","告知");

        private String key;
        private String value;

        private OperateType(String key, String value){
            this.value = value;
            this.key = key;
        }

        public String getValue() {
            return this.value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public static String getKey(Integer value) {
            for(OperateType userType : OperateType.values()){
                if(userType.getValue().equals(value)){
                    return userType.getKey() ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (OperateType type : OperateType.values()) {
                Map map = new HashMap();
                map.put("key", type.getKey());
                map.put("value", type.getValue());
                list.add(map);
            }
            return list;
        }
    }

    public static enum PaywayType {
        CASH("A","现金"),TICKET("1","银票"),AFC("2","AFC融资"),OTHER("3","其他"),REBATEACCOUNT("9","返利账户");

        private String key;
        private String value;

        private PaywayType(String key, String value){
            this.value = value;
            this.key = key;
        }

        public String getValue() {
            return this.value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public static String getKey(Integer value) {
            for(OperateType userType : OperateType.values()){
                if(userType.getValue().equals(value)){
                    return userType.getKey() ;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (OperateType type : OperateType.values()) {
                Map map = new HashMap();
                map.put("key", type.getKey());
                map.put("value", type.getValue());
                list.add(map);
            }
            return list;
        }
    }

    public static enum OrderCancelStatus {
        NORMAL(0, "正常"), WAIT(1, "待审核"),PASS(2, "审核通过"),UNPASS(3, "审核驳回");
        private Integer value;
        private String desc;
        private OrderCancelStatus(Integer value, String desc) {
            this.value = value;
            this.desc = desc;
        }
        public Integer getKey() {
            return this.value;
        }
        public void setKey(Integer value) {
            this.value = value;
        }
        public String getValue() {
            return desc;
        }
        public void setValue(String desc) {
            this.desc = desc;
        }
        public static String getDesc(Integer value) {
            for (OrderCancelStatus sourceType : OrderCancelStatus.values()) {
                if (sourceType.getKey().intValue() == value.intValue()) {
                    return sourceType.getValue();
                }
            }
            return null;
        }
        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (OrderCancelStatus sourceType : OrderCancelStatus.values()) {
                Map map = new HashMap();
                map.put("key", sourceType.getKey());
                map.put("value", sourceType.getValue());
                list.add(map);
            }
            return list;
        }
    }

    public static enum BusType {
        SMALL(0, "小订"), BIG(1, "大定");
        private Integer value;
        private String desc;
        private BusType(Integer value, String desc) {
            this.value = value;
            this.desc = desc;
        }
        public Integer getKey() {
            return this.value;
        }
        public void setKey(Integer value) {
            this.value = value;
        }
        public String getValue() {
            return desc;
        }
        public void setValue(String desc) {
            this.desc = desc;
        }
        public static String getDesc(Integer value) {
            for (BusType sourceType : BusType.values()) {
                if (sourceType.getKey().intValue() == value.intValue()) {
                    return sourceType.getValue();
                }
            }
            return null;
        }
        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (BusType sourceType : BusType.values()) {
                Map map = new HashMap();
                map.put("key", sourceType.getKey());
                map.put("value", sourceType.getValue());
                list.add(map);
            }
            return list;
        }
    }

    //购车方案 1-->购车 2-->体验车 3-->畅想车
    public static enum OrderCustomerBuyType {
        BUY(1,"购车"), HIRE(2,"体验车"),FINANCE(3,"畅享车");

        private String typeName;
        private int code;

        private OrderCustomerBuyType(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (OrderCustomerBuyType type : OrderCustomerBuyType.values()) {
                if (type.getCode() == code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (OrderCustomerBuyType bigType : OrderCustomerBuyType.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum VipApplyStatus {
        DRIFT(1,"待审批"), WAIT(2,"审批中"),REFUSE(3,"已驳回"),AGREE(4,"已通过");

        private String typeName;
        private int code;

        private VipApplyStatus(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (VipApplyStatus type : VipApplyStatus.values()) {
                if (type.getCode() == code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (VipApplyStatus bigType : VipApplyStatus.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum AccountType {
        CASH("A","现金/银票"), DRAFT("1","三方承兑-银票"),FINANCE("2","AFC融资"),REBATE("9","返利/服务费/佣金"),OTHER("3","其他");

        private String typeName;
        private String code;

        private AccountType(String code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public static String getTypeName(String code) {
            for (AccountType type : AccountType.values()) {
                if (type.getCode().equals( code)) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (AccountType bigType : AccountType.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum HireStatus {
        UP(3,"上架"), DOWN(4,"下架");

        private String typeName;
        private int code;

        private HireStatus(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (HireStatus type : HireStatus.values()) {
                if (type.getCode()== code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (HireStatus bigType : HireStatus.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum VehicleStatus {
        PLAN(1, "车辆排产中"), PRODUCE(2, "车辆已生产"), TRANS(3, "车辆运输中"), ARRIVE(4, "车辆已到店");
        private String typeName;
        private int code;

        VehicleStatus(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (VehicleStatus type : VehicleStatus.values()) {
                if (type.getCode()== code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (VehicleStatus bigType : VehicleStatus.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

    public static enum VehicleHireStatus {
        SIGN(1,"可签约"), TI(2,"车辆可提车"),HIRE(3,"车辆已出租"),IN(4,"车辆已入库"),UP(5,"车辆可上架");

        private String typeName;
        private int code;

        private VehicleHireStatus(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (VehicleHireStatus type : VehicleHireStatus.values()) {
                if (type.getCode()== code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (VehicleHireStatus bigType : VehicleHireStatus.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }


    public static enum CustomerSource {
        APP(1,"线索领取"), PARTNER(2,"展厅建档");

        private String typeName;
        private int code;

        private CustomerSource(int code,String typeName) {
            this.typeName = typeName;
            this.code = code;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public static String getTypeName(int code) {
            for (CustomerSource type : CustomerSource.values()) {
                if (type.getCode()== code) {
                    return type.typeName;
                }
            }
            return null;
        }

        public static List getList() {
            List<Map> list = new ArrayList<Map>();
            for (CustomerSource bigType : CustomerSource.values()) {
                Map map = new HashMap();
                map.put("key", bigType.getCode());
                map.put("value", bigType.getTypeName());
                list.add(map);
            }
            return list;
        }
    }

}
